/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { useRef } from 'react';
import { ModalForm, ProFormText } from '@ant-design/pro-form';
import type { ProFormInstance } from '@ant-design/pro-form';
import { Button } from 'antd';

const Index = (props: {
  visible: boolean;
  recordItem: { [name: string]: string };
  onVisibleChange: () => void;
}) => {
  const formRef = useRef<ProFormInstance>();
  const { visible, recordItem, onVisibleChange, ...rest } = props;

  return (
    <ModalForm
      title='开票信息'
      formRef={formRef}
      visible={visible}
      width={540}
      layout='horizontal'
      labelCol={{ span: 9 }}
      modalProps={{
        destroyOnClose: true,
        onCancel: onVisibleChange,
      }}
      submitter={{
        render: () => [<Button onClick={onVisibleChange}>关闭</Button>],
      }}
      labelAlign='left'
      initialValues={recordItem}
      {...rest}
    >
      <ProFormText name='invoice_title' label='发票抬头' readonly></ProFormText>
      <ProFormText name='taxpayer_unionid' label='公司税号' readonly></ProFormText>
      <ProFormText name='bank_name' label='开户行' readonly></ProFormText>
      <ProFormText name='bank_account' label='银行账号' readonly></ProFormText>
      <ProFormText name='company_address' label='公司地址' readonly></ProFormText>
      <ProFormText name='company_phone' label='公司电话' readonly></ProFormText>
    </ModalForm>
  );
};

export default Index;
